package cn.itcast.bos.service.transit.imp;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.itcast.bos.dao.transit.DeliveryInfoDao;
import cn.itcast.bos.dao.transit.TransitInfoDao;
import cn.itcast.bos.domain.transit.DeliveryInfo;
import cn.itcast.bos.domain.transit.TransitInfo;
import cn.itcast.bos.service.transit.DeliveryInfoService;

@Service
@Transactional
public class DeliveryInfoServiceImp implements DeliveryInfoService {

	@Autowired
	private DeliveryInfoDao deliveryInfodao;
	@Autowired
	private TransitInfoDao transitInfoDao;

	@Override
	public void save(String transitInfoId, DeliveryInfo model) {

		// 保存开始配送信息
		deliveryInfodao.save(model);
		//查询运输配送对象
		TransitInfo transitInfo =transitInfoDao.findOne(Integer.parseInt(transitInfoId));
		transitInfo.setDeliveryInfo(model);
		//更改状态
		transitInfo.setStatus("开始配送");
		
	}

}
